/* DTU Web UI 公共样式文件 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    font-weight: 500;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.card-body {
    padding: 1.5rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

/* 警告框样式 */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background: #cce7ff;
    color: #0c5460;
    border-color: #b8e6ff;
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background: #f8f9fa;
    font-weight: 500;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* 状态样式 */
.status-online {
    color: #28a745;
}

.status-offline {
    color: #dc3545;
}

.status-warning {
    color: #ffc107;
}

/* 加载样式 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* 隐藏样式 */
.hidden {
    display: none !important;
}

/* 文本样式 */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #6c757d;
}

.text-primary {
    color: #667eea;
}

.text-success {
    color: #28a745;
}

.text-danger {
    color: #dc3545;
}

.text-warning {
    color: #ffc107;
}

.text-info {
    color: #17a2b8;
}

/* 间距样式 */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 1rem; }

.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 1rem; }

.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 1rem; }

.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 1rem; }

.pl-1 { padding-left: 0.25rem; }
.pl-2 { padding-left: 0.5rem; }
.pl-3 { padding-left: 1rem; }

.pr-1 { padding-right: 0.25rem; }
.pr-2 { padding-right: 0.5rem; }
.pr-3 { padding-right: 1rem; }

/* 页面头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.header .breadcrumb {
    font-size: 0.9rem;
    opacity: 0.9;
}

.device-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 导航标签样式 */
.nav-tabs {
    display: flex;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.nav-tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-decoration: none;
    color: #333;
}

.nav-tab:hover {
    background: #e9ecef;
}

.nav-tab.active {
    background: white;
    color: #667eea;
    font-weight: 500;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.nav-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
}

.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.nav-card h3 {
    color: #667eea;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-card .icon {
    font-size: 1.5rem;
}

.nav-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.nav-card .features {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.nav-card .features ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-card .features li {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    position: relative;
    padding-left: 1rem;
}

.nav-card .features li:before {
    content: "•";
    color: #667eea;
    position: absolute;
    left: 0;
}

@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .nav-tab {
        margin-bottom: 1px;
    }

    .nav-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .nav-card {
        padding: 1.5rem;
    }

    .status-card {
        padding: 1.5rem;
    }

    .status-grid {
        grid-template-columns: 1fr;
    }
}

/* 配置区块样式 */
.config-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
}

.config-section h3 {
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* 输入组样式 */
.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.input-group input {
    flex: 1;
}

/* 命令输出样式 */
.command-output {
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    padding: 1rem;
    border-radius: 4px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    resize: vertical;
    border: 1px solid #333;
}

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.online {
    background: #28a745;
}

.status-indicator.offline {
    background: #dc3545;
}

.status-indicator.warning {
    background: #ffc107;
}

/* 网格布局 */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* 按钮悬停效果 */
.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 表单验证样式 */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.form-group.success input,
.form-group.success select,
.form-group.success textarea {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
}

.form-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast提示样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    min-width: 250px;
    max-width: 350px;
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.toast.success .toast-header {
    background-color: #f6ffed;
    color: #52c41a;
}

.toast.error .toast-header {
    background-color: #fff2f0;
    color: #ff4d4f;
}

.toast.info .toast-header {
    background-color: #e6f7ff;
    color: #1890ff;
}

.toast.warning .toast-header {
    background-color: #fffbe6;
    color: #faad14;
}

.toast-title {
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
}

.toast-body {
    padding: 10px 15px;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .card-body,
    .config-section {
        padding: 1rem;
    }

    .form-row,
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-row .form-group {
        margin-bottom: 1rem;
    }

    .btn {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .input-group input {
        margin-bottom: 0.5rem;
    }
}
